package com.ssy.lingxi.member.merchant.controller.web;

import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.member.merchant.model.vo.basic.request.NamePageVO;
import com.ssy.lingxi.member.merchant.model.vo.lifecycle.request.*;
import com.ssy.lingxi.member.merchant.model.vo.lifecycle.response.*;
import com.ssy.lingxi.member.merchant.service.web.IMemberAppraisalService;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * @menu 会员能力 - 会员考评
 * @author yzc
 * @version 2.0.0
 * @date 2021/5/18
 */
@RestController
@RequestMapping("/member/appraisal")
public class MemberAppraisalController {

    @Resource
    private IMemberAppraisalService memberAppraisalService;

    /**
     * 状态下拉查询
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/statusList", method = RequestMethod.GET)
    public Wrapper<List<StatusVO>> listMemberAppraisalStatus(@RequestHeader HttpHeaders headers) {
        return memberAppraisalService.listMemberAppraisalStatus(headers);
    }

    // ==================================会员考评查询===============================
    /**
     * 会员考评查询 - 会员考评分页列表
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/summary/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberAppraisalSubmitPageQueryVO>> pageSummaryMemberAppraisal(@RequestHeader HttpHeaders headers, @Valid MemberAppraisalSummaryPageVO queryVO) {
        return memberAppraisalService.pageSummaryMemberAppraisal(headers, queryVO);
    }

    /**
     * 会员考评查询 - 会员考评详情
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/summary/get", method = RequestMethod.GET)
    public Wrapper<MemberAppraisalResultVO> getMemberAppraisalSummaryResult(@RequestHeader HttpHeaders headers, @Valid CommonIdVO idVO) {
        return memberAppraisalService.getMemberAppraisalResult(headers, idVO);
    }

    // ==================================待新增考评单===============================

    /**
     * 待新增考评单 - 会员考评分页列表
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/waitPublish/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberAppraisalAddPageQueryVO>> pageWaitAddMemberAppraisal(@RequestHeader HttpHeaders headers, @Valid MemberAppraisalPageVO queryVO) {
        return memberAppraisalService.pageWaitAddMemberAppraisal(headers, queryVO);
    }

    /**
     * 待新增考评单 - 会员考评详情
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/waitPublish/get", method = RequestMethod.GET)
    public Wrapper<MemberAppraisalVO> getMemberAppraisal(@RequestHeader HttpHeaders headers, @Valid CommonIdVO idVO) {
        return memberAppraisalService.getMemberAppraisal(headers, idVO);
    }

    /**
     * 待新增考评单 - 会员考评项目配置分页列表(选择项目)
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/itemConfig/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberConfigAppraisalItemQueryPageVO>> pageMemberConfigAppraisalItem(@RequestHeader HttpHeaders headers, @Valid NamePageVO namePageVO) {
        return memberAppraisalService.pageMemberConfigAppraisalItem(headers, namePageVO);
    }

    /**
     * 待新增考评单 - 会员考评新增
     * @param headers Http头部信息
     * @param addVO 接口参数
     */
    @RequestMapping(value = "/waitPublish/add", method = RequestMethod.POST)
    public Wrapper<Void> deleteMemberAppraisal(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberAppraisalAddVO addVO) {
        return memberAppraisalService.addMemberAppraisal(headers, addVO);
    }

    /**
     * 待新增考评单 - 会员考评修改
     * @param headers Http头部信息
     * @param addVO 接口参数
     */
    @RequestMapping(value = "/waitPublish/update", method = RequestMethod.POST)
    public Wrapper<Void> updateMemberAppraisal(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberAppraisalUpdateVO addVO) {
        return memberAppraisalService.updateMemberAppraisal(headers, addVO);
    }

    /**
     * 待新增考评单 -会员考评删除
     * @param headers Http头部信息
     * @param idsVO 接口参数
     */
    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    public Wrapper<Void> deleteMemberAppraisal(@RequestHeader HttpHeaders headers, @RequestBody @Valid CommonIdsVO idsVO) {
        return memberAppraisalService.deleteMemberAppraisal(headers, idsVO);
    }

    /**
     * 待新增考评单 - 发布
     * @param headers Http头部信息
     * @param idsVO 接口参数
     */
    @RequestMapping(value = "/waitPublish/publish", method = RequestMethod.POST)
    public Wrapper<Void> publishMemberAppraisal(@RequestHeader HttpHeaders headers, @RequestBody @Valid CommonIdsVO idsVO) {
        return memberAppraisalService.publishMemberAppraisal(headers, idsVO);
    }

    // ==================================待考评打分===============================

    /**
     * 待考评打分 - 会员考评分页列表
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/waitGrade/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberAppraisalGradePageQueryVO>> pageWaitGradeMemberAppraisal(@RequestHeader HttpHeaders headers, MemberAppraisalPageVO queryVO) {
        return memberAppraisalService.pageWaitGradeMemberAppraisal(headers, queryVO);
    }

    /**
     * 待考评打分 - 会员考评详情
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/waitGrade/get", method = RequestMethod.GET)
    public Wrapper<MemberAppraisalVO> getWaitGradeMemberAppraisal(@RequestHeader HttpHeaders headers, @Valid CommonIdVO idVO) {
        return memberAppraisalService.getWaitGradeMemberAppraisal(headers, idVO);
    }

    /**
     * 待考评打分 - 打分
     * @param headers Http头部信息
     * @param gradeVO 接口参数
     */
    @RequestMapping(value = "/waitGrade/grade", method = RequestMethod.POST)
    public Wrapper<Void> gradeMemberAppraisal(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberAppraisalGradeVO gradeVO) {
        return memberAppraisalService.gradeMemberAppraisal(headers, gradeVO);
    }

    // ==================================待提交汇总考评结果===============================

    /**
     * 待提交汇总考评结果 - 会员考评分页列表
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/waitSubmit/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberAppraisalSubmitPageQueryVO>> pageWaitSubmitMemberAppraisal(@RequestHeader HttpHeaders headers, MemberAppraisalPageVO queryVO) {
        return memberAppraisalService.pageWaitSubmitMemberAppraisal(headers, queryVO);
    }

    /**
     * 待提交汇总考评结果 - 会员考评详情
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/waitSubmit/get", method = RequestMethod.GET)
    public Wrapper<MemberAppraisalResultVO> getMemberAppraisalSubmitResult(@RequestHeader HttpHeaders headers, @Valid CommonIdVO idVO) {
        return memberAppraisalService.getMemberAppraisalResult(headers, idVO);
    }

    /**
     * 待提交汇总考评结果 - 提交
     * @param headers Http头部信息
     * @param submitVO 接口参数
     */
    @RequestMapping(value = "/waitSubmit/submit", method = RequestMethod.POST)
    public Wrapper<Void> submitBatchMemberAppraisal(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberAppraisalSubmitVO submitVO) {
        return memberAppraisalService.submitMemberAppraisal(headers, submitVO);
    }


    // ==================================待审核考评结果一级===============================

    /**
     * 待审核考评结果一级 - 会员考评分页列表
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/waitAuditOne/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberAppraisalAuditPageQueryVO>> pageWaitAuditOneMemberAppraisal(@RequestHeader HttpHeaders headers, MemberAppraisalPageVO queryVO) {
        return memberAppraisalService.pageWaitAuditOneMemberAppraisal(headers, queryVO);
    }

    /**
     * 待审核考评结果一级 - 会员考评详情
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/waitAuditOne/get", method = RequestMethod.GET)
    public Wrapper<MemberAppraisalResultVO> getMemberAppraisalAuditOneResult(@RequestHeader HttpHeaders headers, @Valid CommonIdVO idVO) {
        return memberAppraisalService.getMemberAppraisalResult(headers, idVO);
    }

    /**
     * 待审核考评结果一级 - 审核
     * @param headers Http头部信息
     * @param agreeVO 接口参数
     */
    @RequestMapping(value = "/waitAuditOne/audit", method = RequestMethod.POST)
    public Wrapper<Void> auditOneMemberAppraisal(@RequestHeader HttpHeaders headers, @RequestBody @Valid CommonAgreeVO agreeVO) {
        return memberAppraisalService.auditOneMemberAppraisal(headers, agreeVO);
    }

    /**
     * 待审核考评结果一级 - 批量审核
     * @param headers Http头部信息
     * @param idsVO 接口参数
     */
    @RequestMapping(value = "/waitAuditOne/auditBatch", method = RequestMethod.POST)
    public Wrapper<Void> auditOneBatchMemberAppraisal(@RequestHeader HttpHeaders headers, @RequestBody @Valid CommonIdsVO idsVO) {
        return memberAppraisalService.auditOneBatchMemberAppraisal(headers, idsVO);
    }

    // ==================================待审核考评结果二级===============================

    /**
     * 待审核考评结果二级 - 会员考评分页列表
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/waitAuditTwo/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberAppraisalAuditPageQueryVO>> pageWaitAuditTwoMemberAppraisal(@RequestHeader HttpHeaders headers, MemberAppraisalPageVO queryVO) {
        return memberAppraisalService.pageWaitAuditTwoMemberAppraisal(headers, queryVO);
    }

    /**
     * 待审核考评结果二级 - 会员考评详情
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/waitAuditTwo/get", method = RequestMethod.GET)
    public Wrapper<MemberAppraisalResultVO> getMemberAppraisalAuditTwoResult(@RequestHeader HttpHeaders headers, @Valid CommonIdVO idVO) {
        return memberAppraisalService.getMemberAppraisalResult(headers, idVO);
    }

    /**
     * 待审核考评结果二级 - 审核
     * @param headers Http头部信息
     * @param agreeVO 接口参数
     */
    @RequestMapping(value = "/waitAuditTwo/audit", method = RequestMethod.POST)
    public Wrapper<Void> auditTwoMemberAppraisal(@RequestHeader HttpHeaders headers, @RequestBody @Valid CommonAgreeVO agreeVO) {
        return memberAppraisalService.auditTwoMemberAppraisal(headers, agreeVO);
    }

    /**
     * 待审核考评结果二级 - 批量审核
     * @param headers Http头部信息
     * @param idsVO 接口参数
     */
    @RequestMapping(value = "/waitAuditTwo/auditBatch", method = RequestMethod.POST)
    public Wrapper<Void> auditTwoBatchMemberAppraisal(@RequestHeader HttpHeaders headers, @RequestBody @Valid CommonIdsVO idsVO) {
        return memberAppraisalService.auditTwoBatchMemberAppraisal(headers, idsVO);
    }

    // ==================================待通报考评结果===============================

    /**
     * 待通报考评结果 - 会员考评分页列表
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/waitNotification/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberAppraisalNotificationPageQueryVO>> pageWaitNotificationMemberAppraisal(@RequestHeader HttpHeaders headers, MemberAppraisalPageVO queryVO) {
        return memberAppraisalService.pageWaitNotificationMemberAppraisal(headers, queryVO);
    }

    /**
     * 待通报考评结果 - 会员考评详情
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/waitNotification/get", method = RequestMethod.GET)
    public Wrapper<MemberAppraisalResultVO> getMemberAppraisalNotificationResult(@RequestHeader HttpHeaders headers, @Valid CommonIdVO idVO) {
        return memberAppraisalService.getMemberAppraisalResult(headers, idVO);
    }

    /**
     * 待通报考评结果 - 通报
     * @param headers Http头部信息
     * @param idsVO 接口参数
     */
    @RequestMapping(value = "/waitNotification/notification", method = RequestMethod.POST)
    public Wrapper<Void> notificationMemberAppraisal(@RequestHeader HttpHeaders headers, @RequestBody @Valid CommonIdsVO idsVO) {
        return memberAppraisalService.notificationMemberAppraisal(headers, idsVO);
    }

    // ==================================考评结果查询===============================

    /**
     * 考评结果查询 - 会员考评分页列表
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/result/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberAppraisalSubResultPageQueryVO>> pageSubResultMemberAppraisal(@RequestHeader HttpHeaders headers, @Valid MemberAppraisalSubResultPageVO queryVO) {
        return memberAppraisalService.pageSubResultMemberAppraisal(headers, queryVO);
    }

    /**
     * 考评结果查询 - 会员考评详情
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/result/get", method = RequestMethod.GET)
    public Wrapper<MemberAppraisalSubResultVO> getSubMemberAppraisalResult(@RequestHeader HttpHeaders headers, @Valid CommonIdVO idVO) {
        return memberAppraisalService.getSubMemberAppraisalResult(headers, idVO);
    }
}
